package com.zhongjianjian.RabbitMq;



import com.zhongjianjian.RabbitMq.config.MyMessagePostProcessor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhongjianjian.elasticjob.utils.UID;

/**
 * @类名: com.zhongjianjian.RabbitMq
 * @作者: lgt
 * @创建时间: 2020-03-02 21:44
 * @描述:
 **/
@RestController
public class TestRabbitMqController {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("sixin")
    public String testSixin(){
        rabbitTemplate.convertAndSend("TEST-EXCHANGE", "TEST-KEY", "hello tt", new MyMessagePostProcessor());
        return "ok";
    }

    @RequestMapping("testConfirm")
    public String testConfirm(){
        CorrelationData correlationData = new CorrelationData();
        correlationData.setId(UID.getUUID16());
        rabbitTemplate.convertAndSend("TEST-EXCHANGE","TEST-KEY","消息的内容",correlationData);
        return "ok";
    }
}
